package com.imay.live.adapter;

import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;
import com.imay.live.model.MenuItemModel;
import com.imay.live.R;

import java.util.List;

/**
 * Created by chan on 2017/4/11.
 */
public class ChoiseDialogAdapter extends BaseQuickAdapter<MenuItemModel, BaseViewHolder> {

    /**
     * Same as QuickAdapter#QuickAdapter(Context,int) but with
     * some initialization data.
     */
    public ChoiseDialogAdapter(List<MenuItemModel> datas) {
        super(R.layout.item_dialog_choise, datas);
    }

    @Override
    protected void convert(BaseViewHolder helper, MenuItemModel item) {
        helper.setText(R.id.tv_item_dialog_choise, mContext.getString(item.getTextId()));
        if (item.getTextId() == R.string.str_family_menu_out) {
            helper.setTextColor(R.id.tv_item_dialog_choise, mContext.getResources().getColor(R.color.text_e1));
        } else {
            helper.setTextColor(R.id.tv_item_dialog_choise, mContext.getResources().getColor(R.color.text_70));
        }
        if (item.getDescId() != 0) {
            helper.setText(R.id.tv_item_dialog_choise_des, mContext.getString(item.getDescId()));
            helper.setVisible(R.id.tv_item_dialog_choise_des, true);
        } else {
            helper.setVisible(R.id.tv_item_dialog_choise_des, false);
        }
        helper.addOnClickListener(R.id.ll_item_dialog_choise);
    }
}
